#include "ofxImageList.h"
ofxImageList::ofxImageList() {
}

void ofxImageList::loadFromDir(string sDir) {
	int num_files = dir_list.listDir(sDir);
	for(int i = 0; i < num_files; ++i) {
		ofImage img;
		img.loadImage(dir_list.getPath(i));
		images.push_back(img);
		printf("Loaded image: %i from %i\n", i+1, num_files);
	}
	iter = images.begin();
	printf("Number of images found: %i\n", num_files);
	
}

bool ofxImageList::hasNext() {
	return iter != images.end();
}

void ofxImageList::draw(float fX, float fY) {
	(*iter).draw(fX, fY);
}


void ofxImageList::prev() {
	if(iter == images.begin())
		return;
	iter--;
}

void ofxImageList::next() {
	if(iter == images.end())
		return;
	iter++;
}

ofImage ofxImageList::getCurrent() {
	return (*iter);
}


